﻿using System.ComponentModel.Design;
using System.Windows.Forms;

namespace Nextensions.GUI
{
    public class NavigationControllerDesigner: ComponentDesigner
    {
        private Form _owner;

        public override void InitializeNewComponent(System.Collections.IDictionary defaultValues)
        {
            base.InitializeNewComponent(defaultValues);

            if (ParentComponent.GetType() == typeof(Form))
            {
                _owner = ParentComponent as Form;
                Control.Owner = _owner;
                Control.PageSize = Control.Orientation == Orientation.Vertical ? _owner.Height : _owner.Width;
            }
        }

        private NavigationController Control
        {
            get
            {
                return Component as NavigationController;
            }
        }
    }
}
